package spring.boot.admin.service;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import spring.boot.admin.mapper.TDistrictMapper;
import spring.boot.admin.model.Pages;
import spring.boot.admin.model.TDistrict;

@Slf4j
@Service
@DS("one")
public class TDistrictService extends ServiceImpl<TDistrictMapper, TDistrict> {

    public IPage pageList(Integer page, Integer rows, String pcode, String ppcode) {
        //为适应 easyui的分页插件,稍微修改原参数名称，自定义Pages
        Pages<TDistrict> pages = new Pages<>(page, rows);
        if(pcode==null||pcode.trim().length()<=0||"0".equalsIgnoreCase(pcode.trim())){
            pcode=null;
        }
        if(ppcode==null||ppcode.trim().length()<=0||"0".equalsIgnoreCase(ppcode.trim())){
            ppcode=null;
        }
        return baseMapper.pageList(pages, pcode, ppcode);
    }

}
